package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.dto.DevicePageQueryDto;
import com.zzyl.entity.Device;
import com.zzyl.vo.DeviceVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DeviceMapper {
    @Select("select count(1) from device where device_name = #{deviceName}")
    int selectByDeviceName(String deviceName);

    void insert(Device device);

    Page<Device> queryPage(String deviceName, Integer locationType, String productKey);

    DeviceVo selectByIotId(String iotId);

    @Select("SELECT * FROM device where id = #{id}")
    Device selectDeviceById(Long id);

    void update(Device device);

    @Delete("delete from device where iot_id = #{iotId}")
    void deleteByIotId(String iotId);

    List<Long> selectNursingIdsByIotIdWithElder(String iotId);

    List<Long> selectNursingIdsByIotIdWithBed(String iotId);
}
